package com.zangs.emqx_expand.emqx.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zangs.emqx_expand.common.annotation.Excel;
import com.zangs.emqx_expand.common.core.domain.BaseEntity;

import javax.validation.constraints.NotNull;

/**
 * MQTT 用户对象 mqtt_user
 * 
 * @author zangs
 * @since 2025-01-25
 */
@ApiModel(value = "MqttUser", description = "emqx用户")
public class MqttUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 唯一标识符 */
    @ApiModelProperty("id")
    private Long id;

    /** 用户唯一标识 */
    @ApiModelProperty("userUid")
    @NotNull(message = "用户uid不能为空")
    @Excel(name = "userUid")
    private String userUid;

    /** 用户名 */
    @ApiModelProperty("用户名")
    @NotNull(message = "用户名不能为空")
    @Excel(name = "用户名")
    private String username;

    /** 密码 */
    @ApiModelProperty("密码")
    @NotNull(message = "密码不能为空")
    @Excel(name = "密码")
    private String password;

    /** 盐值 */
    @ApiModelProperty("盐值")
    @NotNull(message = "必须加盐")
    @Excel(name = "盐值")
    private String salt;


    /** 是否为超级用户 */
    @ApiModelProperty("是否为超级用户")
    @Excel(name = "是否为超级用户")
    private Boolean isSuperuser;

    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date created;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setUserUid(String userUid) 
    {
        this.userUid = userUid;
    }

    public String getUserUid() 
    {
        return userUid;
    }
    public void setUsername(String username) 
    {
        this.username = username;
    }

    public String getUsername() 
    {
        return username;
    }
    public void setPassword(String password) 
    {
        this.password = password;
    }

    public String getPassword() 
    {
        return password;
    }
    public void setSalt(String salt) 
    {
        this.salt = salt;
    }

    public String getSalt() 
    {
        return salt;
    }
    public void setIsSuperuser(Boolean isSuperuser) 
    {
        this.isSuperuser = isSuperuser;
    }

    public Boolean getIsSuperuser() 
    {
        return isSuperuser;
    }
    public void setCreated(Date created) 
    {
        this.created = created;
    }

    public Date getCreated() 
    {
        return created;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userUid", getUserUid())
            .append("username", getUsername())
            .append("password", getPassword())
            .append("salt", getSalt())
            .append("isSuperuser", getIsSuperuser())
            .append("created", getCreated())
            .toString();
    }
}
